<?php

/**
 * Description of the watches relationship between customer and movie
 *
 * @author Scott McKay
 */
 class Application_Model_Watches extends Zend_Db_Table_Abstract {
 	
 	protected $_name = 'Watches';
 	
 	public function getComments($idMovie) {
 		$sql = "SELECT Grade, Login, Comment FROM Watches w, Customer cu, Comment co WHERE w.Movie_ID = ? AND " .
 				"w.Customer_ID = cu.Customer_ID AND co.Comment_ID = w.Comment_ID ORDER BY co.Comment_ID DESC";
 		$params = array($idMovie);
 		return $this->getAdapter()->query($sql,$params)->fetchAll();
 	}
 	
 	/**
 	 * Function to add a room to the database
 	 * 
 	 * @param Room_ID The ID of the new room
 	 */
 	public function addWatch($Movie_ID, $Comment_ID, $Customer_ID) {
		$sql = "INSERT INTO Watches (Watches_ID, Movie_ID, Comment_ID, Customer_ID) VALUES (Null, :mid, :cid, :custid)"; 
		$params = array(":mid" => $Movie_ID, ":cid" => $Comment_ID, ":custid" => $Customer_ID);
		$this->getAdapter()->query($sql,$params);
	}
 }
 
 ?>
